﻿<!DOCTYPE html>
<html>
<head>
    <title>Mobile CRM</title>
    <script type="text/javascript" src="scripts/jquery-1.8.0.js"></script>
    <script type="text/javascript" src="scripts/jquery.validate.js"></script>
    <script type='text/javascript' src='scripts/jquery.mobile-1.2.0-pre.js'></script>
    <script type='text/javascript' src='scripts/knockout-2.1.0.js'></script>
    <script type="text/javascript" src="scripts/mKook.js"></script>
    <script type="text/javascript" src="scripts/viewModels.js"></script>
    <script type="text/javascript" src="scripts/views.js"></script>
    <script type="text/javascript" src="scripts/webAPICommands.js"></script>

    <link href="Content/jquery.mobile-1.2.0-pre.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div data-role="page">
        <div data-role="header">
            <h1 data-bind="text: data.user">Login form</h1>
        </div>
        <div data-role="content">
            <p></p>
            <ul data-role="listview" data-inset="true">
                <li data-role="fieldcontain">
                    <label for="inpUserName">Username</label>
                    <input id="inpUserName" type="text" data-bind="value: data.user"/>
                </li>
                <li data-role="fieldcontain">
                    <label for="inpPassword">Password</label>
                    <input id="inpPassword" type="password" data-bind="value: data.pass"/>
                </li>
                <li data-role="fieldcontain">
                    <label for="inpRememberMe">Remember me?</label>
                    <input id="inpRememberMe" type="checkbox" data-bind="checked: data.auto"/>
                </li>
                <li data-role="fieldcontain">
                    <button id="btnLogin" name="btnLogin">Log in</button>
                </li>
            </ul>
            <div data-bind="visible: data.error.length > 0">
                <p><strong data-bind="text: data.error" style="color: Red"></strong></p>
            </div>
        </div>
        <div data-role="footer">
            <h4>Login form</h4>
        </div>
    </div>
<!-- Описание моделей -->
<script id="crmRequest" type="text/javascript">
    var reqAuth = { name: 'getAuth', key: '', data: {} };
    var reqActionList = { name: 'getActionList', key: '', data: {} };
</script>
<!-- Описание шаблонов -->
<script id="crmModel" type="text/javascript">
    
</script>
<script id="crmTable" type="text/javascript">
    var crmTables = { "createTables":
            [
            { "table": "tbl_request", "property": [
                { "name": "id", "type": "INTEGER PRIMARY KEY AUTOINCREMENT" },
                { "name": "time", "type": "TEXT" },
                { "name": "stat", "type": "TEXT" },
                { "name": "name", "type": "TEXT" },
                { "name": "key", "type": "TEXT" },
                { "name": "data", "type": "TEXT" }
                ]
            },
            { "table": "tbl_model", "property": [
                { "name": "id", "type": "INTEGER PRIMARY KEY AUTOINCREMENT" },
                { "name": "name", "type": "TEXT" },
                { "name": "data", "type": "TEXT" }
                ]
            },
            { "table": "tbl_template", "property": [
                { "name": "id", "type": "INTEGER PRIMARY KEY AUTOINCREMENT" },
                { "name": "name", "type": "TEXT" },
                { "name": "data", "type": "TEXT" }
                ]
            }
            ]
    };
</script>
<script id="crmMain" type="text/javascript">
    //Начальные данные для иницализации mKook
    var mkOptions = { dbName: 'crmDB', dbVersion: '1.0', dbDesc: 'Mobile CRM Database', dbSize: 4 * 1024 * 1024, dbTables: crmTables, viewModel: new vmAuth() };
    //Создание объекта mKook
    var mk = new mKook(mkOptions);
    //Запуск приложения    
    mk.run();
</script>
</body>
</html>
